const db = require("../../../db");

const userList = (req, res) => {
  let { userId } = req.body;
  let sql = `SELECT * FROM friendlist a,user b where a.friendId = b.id and a.userId = ${userId} and a.status = 1`;
  db.query(sql, (err, result) => {
    if (err) return res.send({ code: 2, message: err.message });
    if (result.length === 0)
      return res.send({ code: 1, message: "暂无好友列表" });
    res.send({ code: 0, data: result });
  });
};

module.exports = userList;
